#include <iostream>
#include <cstdio>
#include<unordered_map>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long LL;
void pr(vector<pair<int, unordered_map<int, int>>>& v, const int& l, const int& r, const int& k)
{
    //unordered_map<int, int>ml = v[l-1].second;
    //unordered_map<int, int>mr = v[r].second;
    int re = 0;
    for (pair<int, int>g : v[r].second)
    {
        //cout << g1->first << " " << g1->second << endl;
        //if (g.first == v[l - 1].first && g.first == v[r - 1].first) { if (g.second - g1->second == k - 1) { re++; continue; } }
        if ((g.second- (v[l].second.find(g.first))->second) == k) { /*cout << g.first <<" "<< g.second<< endl;*/ re++; }
    }
    cout << re << endl;
}
void cle(unordered_map<int, int>& m)
{
    for (pair<int, int>g : m)
    {
        g.second = 0;
    }
}
int main() 
{
    vector<pair<int, unordered_map <int, int>>> v;
    unordered_map<int, int>m;
    //vector<pair<int, map <int, int>>> v;
    //map<int, int>m;
    int n, q;
    cin >> n >> q;
    //int* arr = new int[n];
    //for (int i = 0; i < n; i++)
    //{
    //    cin >> arr[i];
    //    s.insert(arr[i]);
    //}
    //for (int g : s)
    //{
    //    m.insert(pair<int, int>(g, 0));
    //}
    v.resize(n+1);
    //v[0].second = m;
    for (int i = 1; i < n + 1; i++)
    {
        cin >> v[i].first;
        m.insert(pair<int, int>(v[i].first, 0));
    }
    v[0].second = m;

    //
    int l, r, k;
    set<int>s;
    vector<int>v1;
    v1.resize(q * 3);
    for (int i = 0; i < 3*q; i=i+3)
    {
        cin >> l >> r >> k;
        s.insert(l-1);
        s.insert(r);
        v1[i] = l-1;
        v1[i+1] = r;
        v1[i+2] = k;
        //pr(v, l, r, k);
    }
    for (int i = 1; i < n + 1; i++)
    {
        (m.find(v[i].first))->second++;
        if (s.find(i) != s.end()) {  v[i].second = m; }
        
    }
    for (int i = 0; i < 3 * q; i = i + 3)
    {
        pr(v, v1[i], v1[i + 1], v1[i + 2]);
    }
    /*
12 2
1 4 2 3 1 2 5 1 4 7 8 10
2 5 1
1 12 2
    */
}








#include <iostream>
#include <cstdio>
#include<unordered_map>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long LL;
void pr(vector<pair<int, map <int, int>>>& v, const int& l, const int& r, const int& k)
{
    //unordered_map<int, int>ml = v[l-1].second;
    //unordered_map<int, int>mr = v[r].second;
    int re = 0;
    for (pair<int, int>g : v[r].second)
    {
        //cout << g1->first << " " << g1->second << endl;
        //if (g.first == v[l - 1].first && g.first == v[r - 1].first) { if (g.second - g1->second == k - 1) { re++; continue; } }
        if ((g.second- (v[l - 1].second.find(g.first))->second) == k) { /*cout << g.first <<" "<< g.second<< endl;*/ re++; }
    }
    cout << re << endl;
}
void cle(map<int, int>& m)
{
    for (pair<int, int>g : m)
    {
        g.second = 0;
    }
}
int main() 
{
    //vector<pair<int, unordered_map <int, int>>> v;
    //unordered_map<int, int>m;
    vector<pair<int, map <int, int>>> v;
    map<int, int>m;
    int n, q;
    cin >> n >> q;
    //int* arr = new int[n];
    //for (int i = 0; i < n; i++)
    //{
    //    cin >> arr[i];
    //    s.insert(arr[i]);
    //}
    //for (int g : s)
    //{
    //    m.insert(pair<int, int>(g, 0));
    //}
    v.resize(n+1);
    //v[0].second = m;
    for (int i = 1; i < n + 1; i++)
    {
        cin >> v[i].first;
        m.insert(pair<int, int>(v[i].first, 0));
    }
    v[0].second = m;
    //for (int i = 1; i < n+1; i++)
    //{
    //    (m.find(v[i].first))->second++;
    //    v[i].second=m;
    //}
    //
    int l, r, k;
    for (int i = 0; i < q; i++)
    {
        cin >> l >> r >> k;
        m = v[0].second;
        for (int j = 1; j <= r; j++)
        {
            (m.find(v[j].first))->second++;
            if(j==l-1){ v[j].second = m; }
        }
        v[r].second = m;
        pr(v, l, r, k);
    }
    /*
12 2
1 4 2 3 1 2 5 1 4 7 8 10
2 5 1
1 12 2
    */
}




#include <iostream>
#include <cstdio>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<set>
#include<map>
using namespace std;
int mat[300][300];
void dfs(int mat[300][300],int i,const int n, unordered_set<int>&s,int&re,int&Max)
{
    if (i+1==n)
    {
        Max = max(re, Max);
        return;
    }
    for (int j = 0; j < n; j++)
    {
        if (mat[i][j] == 1)
        {
            if (s.find(j)==s.end())
            {
                s.insert(j);
                dfs(mat, j, n,  s,re,Max);
                s.erase(j);
            }
            else
            {
                //遇到重复就改
                mat[i][j] = 0;
                re++;
                continue;
            }
        }
    }

}
int main() 
{
    vector<pair<int, unordered_map <int, int>>> v;
    unordered_map<int, int>m;
    //vector<pair<int, map <int, int>>> v;
    //map<int, int>m;
    int n, q;
    cin >> n ;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> mat[i][j];
        }
    }
    unordered_set<int>s;
    int re = 0;
    int Max = 0;
    dfs(mat, 0, n, s, re,Max);
    cout << Max;
}














